<?php

class UI extends Template
{

    public $showbodytag = true;

    public function UI($showbodytag = true , $title = "",$game=false)
    {
		$skindir="skin/".G_TEMPLATE_Member."/";
        $this->setdir("core/tpl/".G_TEMPLATE."/");
		$this->set("skindir",$skindir);
        $this->load("main" , "css.htm");
		$header='';
		if($game)
		{
			$header='<link href="'.$skindir.'css/style.css" rel="stylesheet" type="text/css">
			<link href="'.$skindir.'css/style2.css" rel="stylesheet" type="text/css">
			<link rel="StyleSheet" type="text/css" href="'.$skindir.'css/site.css">
			<link rel="stylesheet" href="'.$skindir.'css/view.css">
			<script language="javascript" src="'.$skindir.'js/xzxq_list.js"></script>';
				
		}
		elseif($showbodytag)
		{
			$header='<link REL="StyleSheet" type="text/css" href="core/tpl/k2/site.css">
		  	<link REL="StyleSheet" type="text/css" href="loginTpl/color_0/clc.css">
		  	<link REL="StyleSheet" type="text/css" href="loginTpl/bar_Gold/bar.css">';
	
		}
		$this->set("header",$header);	
        if ( $title != "" )
        {
            $this->set("sitename" , $title);
        }
        else if ( defined("L_SITENAME") )
        {
            $this->set("sitename" , L_SITENAME);
        }
        else
        {
            $this->set("sitename" , G_SITENAME);
        }
        $this->showbodytag = $showbodytag;
        if ( $showbodytag == false )
        {
            $this->set("nobody1" , "<!-- ");
            $this->set("nobody2" , " -->");
        }
        global $curruser;
        if ( $showbodytag )
        {
            require_once( "CheckMode_6.php" );
            $chk = new CheckMode_6($curruser['acl'] , 2);
            $chk->checkShow6Page();
            unset($chk);
        }
        $this->show("main");
    }

    public function header($admin=false)
    {
        global $g_init_mode_6h;
        global $g_init_mode_3d;
        global $g_menu_enabled;
        $conf = new Config();
        if($admin){
			$this->setdir("core/tpl/".G_TEMPLATE."/");
        	$this->load("main" , "header.htm");
		}else{
			$this->setdir("skin/".G_TEMPLATE_Member."/");
			$this->load("main" , "top.tpl");
			$this->set("skindir","skin/".G_TEMPLATE_Member."/");
		}
		//
        $timetamp = systime();
        $today = date("Y-m-d");
        if ( $g_init_mode_6h )
        {
            $stopbet = min($conf->get("linebet") , $conf->get("waitbet"));
            $stopbet = min($stopbet , $conf->get("othebet"));
            $stopbet = min($stopbet , $conf->get("stopbet"));
            if ( $stopbet == "0000" )
            {
                $stopbet = "2359";
            }
            $stopbet = str_pad($stopbet , 4 , "0" , STR_PAD_LEFT);
            $h = substr($stopbet , 0 , 2);
            $m = substr($stopbet , 2);
            $tempStr = "{$today} {$h}:{$m}:00";
            $timetamplimit = strtotime($tempStr) - $timetamp;
            $this->set("lastTimeForStop0" , $timetamplimit);
            $this->set("is2D" , "true");
            if ( 0 < $timetamplimit )
            {
                $showOpenRound = "";
                $showOpenNum = "";
                $sql = "SELECT n1,n2,n3,n4,n5,n6,spec,round FROM lotto WHERE open < '{$today}' ORDER BY open DESC,id DESC LIMIT 0,1";
                $rs = getdb($sql);
                if ( ! $rs->eof )
                {
                    $showOpenRound = "<span style=\"border:1px #fff dashed;\"><strong>六合彩</strong>&nbsp;第&nbsp;".$rs->f['round']."&nbsp;期</span>";
                    $showOpenNum = "<img src='image/ball_S".str_pad($rs->f['n1'] , 2 , "0" , STR_PAD_LEFT).".gif' align='middle' />";
                    $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n2'] , 2 , "0" , STR_PAD_LEFT).".gif' align='middle' />";
                    $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n3'] , 2 , "0" , STR_PAD_LEFT).".gif' align='middle' />";
                    $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n4'] , 2 , "0" , STR_PAD_LEFT).".gif' align='middle' />";
                    $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n5'] , 2 , "0" , STR_PAD_LEFT).".gif' align='middle' />";
                    $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n6'] , 2 , "0" , STR_PAD_LEFT).".gif' align='middle' />";
                    $showOpenNum .= "<font style=\"background-color:#FFCCCC;\">特别号</font>";
                    $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['spec'] , 2 , "0" , STR_PAD_LEFT).".gif' align='middle' />";
                }
                $this->set(array ( "showOpenRound_0" => $showOpenRound , "showOpenNum_0" => $showOpenNum ));
            }
        }
        if ( $g_init_mode_3d )
        {
            $stopbet = $conf->get("stopbet_3d");
            if ( $stopbet == "0000" )
            {
                $stopbet = "2359";
            }
            $stopbet = str_pad($stopbet , 4 , "0" , STR_PAD_LEFT);
            $h = substr($stopbet , 0 , 2);
            $m = substr($stopbet , 2);
            $tempStr = "{$today} {$h}:{$m}:00";
            $timetamplimit = strtotime($tempStr) - $timetamp;
            $this->set("lastTimeForStop1" , $timetamplimit);
            if ( 0 < $timetamplimit )
            {
                $showOpenRound = "";
                $showOpenNum = "";
                $sql = "SELECT n3,n2,n1,round FROM lotto_3d WHERE open < '{$today}' ORDER BY open DESC,id DESC LIMIT 0,1";
                $rs = getdb($sql);
                if ( ! $rs->eof )
                {
                    $showOpenRound = "<span style=\"border:1px #fff dashed;\"><strong>福彩3D</strong>&nbsp;第&nbsp;".$rs->f['round']."&nbsp;期</span>";
                    $showOpenNum = "<img src='image/ball3d".$rs->f['n3'].".png' />";
                    $showOpenNum .= "<img src='image/ball3d".$rs->f['n2'].".png' />";
                    $showOpenNum .= "<img src='image/ball3d".$rs->f['n1'].".png' />";
                }
                $this->set(array ( "showOpenRound_1" => $showOpenRound , "showOpenNum_1" => $showOpenNum ));
            }
            $stopbet = $conf->get("stopbet_3t");
            if ( $stopbet == "0000" )
            {
                $stopbet = "2359";
            }
            $stopbet = str_pad($stopbet , 4 , "0" , STR_PAD_LEFT);
            $h = substr($stopbet , 0 , 2);
            $m = substr($stopbet , 2);
            $tempStr = "{$today} {$h}:{$m}:00";
            $timetamplimit = strtotime($tempStr) - $timetamp;
            $this->set("lastTimeForStop2" , $timetamplimit);
            $this->set("is3D" , $g_menu_enabled[1] || $g_menu_enabled[2]?"true":"false" );
            if ( 0 < $timetamplimit )
            {
                $showOpenRound = "";
                $showOpenNum = "";
                $sql = "SELECT n3,n2,n1,round FROM lotto_3t WHERE open < '{$today}' ORDER BY open DESC,id DESC LIMIT 0,1";
                $rs = getdb($sql);
                if ( ! $rs->eof )
                {
                    $showOpenRound = "<span style=\"border:1px #fff dashed;\"><strong>体彩P3</strong>&nbsp;第&nbsp;".$rs->f['round']."&nbsp;期</span>";
                    $showOpenNum = "<img src='image/ball3d".$rs->f['n3'].".png' />";
                    $showOpenNum .= "<img src='image/ball3d".$rs->f['n2'].".png' />";
                    $showOpenNum .= "<img src='image/ball3d".$rs->f['n1'].".png' />";
                }
                $this->set(array ( "showOpenRound_2" => $showOpenRound , "showOpenNum_2" => $showOpenNum ));
            }
        }

        $this->set("g_system_name" , G_SITENAME);
        $this->set("gametype" , "0");
        $this->show("main");
    }

    public function footer()
    {
        global $G_DB_QUERY_COUNT;
        global $curruser;
        global $g_cache;
        $this->setdir("core/tpl/".G_TEMPLATE."/");
        $this->load("main" , "footer.htm");
        if ( defined("L_COPYRIGHT") )
        {
            $this->set("copyright" , L_COPYRIGHT);
        }
        else
        {
            $this->set("copyright" , G_COPYRIGHT);
        }
        if ( G_DEBUG || $curruser['acl'] == 255 )
        {
            $msg = "<br>Page Time: <b>".substr(getmicrotime() - G_SCRIPTSTART , 0 , 6)."</b>s";
            $msg .= "<br>DB Query Count: <b>".$G_DB_QUERY_COUNT."</b>";
            //if ( $curruser['account'] == G_SUPERACCOUNT )
            //{
            //    $msg .= "<br>WebServerIP:".$_SERVER['SERVER_ADDR']."</b>";
            //}
            $this->set("debugmsg" , $msg);
        }
        $this->show("main");
        if ( isset($g_cache['db_sqldebug']) )
        {
            echo "<table border=1 cellpadding=2 cellspacing=0>";
            $total = 0;
            $i = 1;
            foreach ( $g_cache['db_sqldebug'] as $val )
            {
                echo "<tr><td align=right>".$i ++."<td>".$val[0];
                echo "<td align=right>".substr($val[2] - $val[1] , 0 , 8);
                $total += $val[2] - $val[1];
            }
            echo "<tr><td colspan=4 align=right>".substr($total , 0 , 8)."</table>";
        }
    }

    public function showErrorPage($err , $newsFlag = false)
    {
        global $g_conf;
        @ob_clean();
        $this->UI();
        if ( $newsFlag )
        {
           // include_once( "member/news.php" );
        }
        $this->set("msg" , $err);
        $this->load("main" , "msg_3d.htm");
        $this->show("main");
        $this->footer();
        $str = ob_get_contents();
        ob_end_clean();
        echo $str;
        exit();
    }

}

class UI_3D extends Template
{

    public $showbodytag = true;
    public $title;

    public function UI_3D($showbodytag = true , $title = "")
    {
        $this->setdir("core/tpl/".G_TEMPLATE."/");
		$this->set("skindir",'skin/'.G_TEMPLATE_Member.'/');
        $this->showbodytag = $showbodytag;
        $this->title = $title;
        if ( $showbodytag == false )
        {
            $this->set("nobody1" , "<!-- ");
            $this->set("nobody2" , " -->");
        }
    }

    public function header()
    {
        global $gametype;
        global $g_init_mode_6h;
        if ( $this->title != "" )
        {
            $this->set("sitename" , $this->title);
        }
        else if ( defined("L_SITENAME") )
        {
            $this->set("sitename" , L_SITENAME);
        }
        else
        {
            $this->set("sitename" , G_SITENAME);
        }
        if ( $gametype == 2 )
        {
            $this->set("3dbg" , "3t");
        }
        $this->load("header" , "header_3d.htm");
        $this->set("sitecss" , $gametype);
        $this->show("header");
    }

    public function showTopFrame($gametype = 1)
    {
        global $conf;
        global $g_gametype_3d;
        global $g_init_mode_6h;
        global $g_init_mode_3d;
        global $g_menu_enabled;
        $tbl = $g_gametype_3d[$gametype]['en'];
        $this->load("topFrame" , "header.htm");
        $timetamp = systime();
        $today = date("Y-m-d");
        if ( $g_init_mode_6h )
        {
            $stopbet = min($conf->get("linebet") , $conf->get("waitbet"));
            $stopbet = min($stopbet , $conf->get("othebet"));
            $stopbet = min($stopbet , $conf->get("stopbet"));
            if ( $stopbet == "0000" )
            {
                $stopbet = "2359";
            }
            $stopbet = str_pad($stopbet , 4 , "0" , STR_PAD_LEFT);
            $h = substr($stopbet , 0 , 2);
            $m = substr($stopbet , 2);
            $tempStr = "{$today} {$h}:{$m}:00";
            $timetamplimit = strtotime($tempStr) - $timetamp;
            $this->set("lastTimeForStop0" , $timetamplimit);
            $this->set("is2D" , "true");
            $showOpenRound = "123";
            $showOpenNum = "321";
            $sql = "SELECT n1,n2,n3,n4,n5,n6,spec,round FROM lotto WHERE open < '{$today}' ORDER BY open DESC,id DESC LIMIT 0,1";
            $rs = getdb($sql);
            if ( ! $rs->eof )
            {
                $showOpenRound = "<span style=\"border:1px #fff dashed;\"><strong>六合彩</strong>&nbsp;第&nbsp;".$rs->f['round']."&nbsp;期</span>";
                $showOpenNum = "<img src='image/ball_S".str_pad($rs->f['n1'] , 2 , "0" , STR_PAD_LEFT).".gif' />";
                $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n2'] , 2 , "0" , STR_PAD_LEFT).".gif' />";
                $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n3'] , 2 , "0" , STR_PAD_LEFT).".gif' />";
                $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n4'] , 2 , "0" , STR_PAD_LEFT).".gif' />";
                $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n5'] , 2 , "0" , STR_PAD_LEFT).".gif' />";
                $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['n6'] , 2 , "0" , STR_PAD_LEFT).".gif' />";
                $showOpenNum .= "<font style=\"background-color:#FFCCCC\">特别号</font>";
                $showOpenNum .= "<img src='image/ball_S".str_pad($rs->f['spec'] , 2 , "0" , STR_PAD_LEFT).".gif' />";
            }
            $this->set(array ( "showOpenRound_0" => $showOpenRound , "showOpenNum_0" => $showOpenNum ));
        }
        if ( $g_init_mode_3d )
        {
            $stopbet = $conf->get("stopbet_3d");
            if ( $stopbet == "0000" )
            {
                $stopbet = "2359";
            }
            $stopbet = str_pad($stopbet , 4 , "0" , STR_PAD_LEFT);
            $h = substr($stopbet , 0 , 2);
            $m = substr($stopbet , 2);
            $tempStr = "{$today} {$h}:{$m}:00";
            $timetamplimit = strtotime($tempStr) - $timetamp;
            $this->set("lastTimeForStop1" , $timetamplimit);
            $stopbet = $conf->get("stopbet_3t");
            if ( $stopbet == "0000" )
            {
                $stopbet = "2359";
            }
            $stopbet = str_pad($stopbet , 4 , "0" , STR_PAD_LEFT);
            $h = substr($stopbet , 0 , 2);
            $m = substr($stopbet , 2);
            $tempStr = "{$today} {$h}:{$m}:00";
            $timetamplimit = strtotime($tempStr) - $timetamp;
            $this->set("lastTimeForStop2" , $timetamplimit);
            $this->set("is3D" , $g_menu_enabled[1] || $g_menu_enabled[2]?"true":"false" );
            $showOpenRound = "";
            $showOpenNum = "";
            $sql = "SELECT n3,n2,n1,round FROM lotto_3d WHERE open < '{$today}' ORDER BY open DESC,id DESC LIMIT 0,1";
            $rs = getdb($sql);
            if ( ! $rs->eof )
            {
                $showOpenRound = "<span style=\"border:1px #fff dashed;width:250px!important\"><strong>福彩3D</strong>&nbsp;第&nbsp;".$rs->f['round']."&nbsp;期</span>";
                $showOpenNum = "<img src='image/ball3d".$rs->f['n3'].".png' />";
                $showOpenNum .= "<img src='image/ball3d".$rs->f['n2'].".png' />";
                $showOpenNum .= "<img src='image/ball3d".$rs->f['n1'].".png' />";
            }
            $this->set(array ( "showOpenRound_1" => $showOpenRound , "showOpenNum_1" => $showOpenNum ));
            $showOpenRound = "";
            $showOpenNum = "";
            $sql = "SELECT n3,n2,n1,round FROM lotto_3t WHERE open < '{$today}' ORDER BY open DESC,id DESC LIMIT 0,1";
            $rs = getdb($sql);
            if ( ! $rs->eof )
            {
                $showOpenRound = "<span style=\"border:1px #fff dashed;width:250px!important\"><strong>体彩P3</strong>&nbsp;第&nbsp;".$rs->f['round']."&nbsp;期</span>";
                $showOpenNum = "<img src='image/ball3d".$rs->f['n3'].".png' />";
                $showOpenNum .= "<img src='image/ball3d".$rs->f['n2'].".png' />";
                $showOpenNum .= "<img src='image/ball3d".$rs->f['n1'].".png' />";
            }
            $this->set(array ( "showOpenRound_2" => $showOpenRound , "showOpenNum_2" => $showOpenNum ));
        }
        $this->set(array ( "gametype" => $gametype , "g_system_name" => G_SITENAME ));
        $this->show("topFrame");
    }

    public function showNews3D($acl,$flag=0)
    {
        global $g_color;
        global $g_gametype_3d;
        global $gametype,$curruser;
        if ( $acl == 1) // && $gametype!=1 && $gametype!=2
        {
            $conf = new Config();
            $news=$news_add = "";
			if($flag==1){
				//$news_add = $conf->Get("news_th");
				//$news = $news_add == ""?"":"<font color=red><b>系统重大公告:&nbsp;</b>".$news_add."</font>   ";
				$news="";
				/*if ( 1 < $acl )
				{
					$news_add = $conf->Get("news_th_".$g_gametype_3d[$gametype]['en']);
					$news .= $news_add == ""?"":"<font color=#008F00><b>".$g_gametype_3d[$gametype]['ch']."管理层公告:&nbsp;</b>".$news_add."</font>   ";
			   	}*/
			   	$news_add = $conf->Get("news_".$g_gametype_3d[$gametype]['en']);
			   	$news .= $news_add == ""?"":"<font color=#00000><b>".$g_gametype_3d[$gametype]['ch']."会员公告:&nbsp;</b>".$news_add."</font>   ";
			}

			if($gametype==24)
				$width = "800";
			elseif ( $g_gametype_3d[$gametype]['type'] == 3 )
                $width = "740";
            else
            {
                $width = 1 < $acl?"758":"700";
            }
            $this->set("width" , $width);
			$this->set("type" , $gametype);
            $this->set("g_color" , $g_color);
			//开奖号码
			/*if($flag==0){
				$sql = "SELECT sum(b1) as c FROM bet_".$g_gametype_3d[$gametype]['en']." WHERE user_id='".$curruser['id']."' and createtime>='".strtotime(date('Y-m-d'))."' and createtime<='".time()."'";
				$rs = getdb($sql);
				if ( ! $rs->eof )
					$this->set("bettotal" , (empty($rs->f["c"])?0:round($rs->f["c"],2)));		
				else
					$this->set("bettotal",0);
				$sql = "SELECT * FROM lotto_".$g_gametype_3d[$gametype]['en']." WHERE  n1 >= 0 order by open desc limit 1";
				$rs = getdb($sql);
				$kjhm="";
				if ( ! $rs->eof )
				{
					$kjhm="<div class='kjhm'><font color=#2935E3>".$rs->f['round']."期开奖</font>&nbsp;&nbsp";
					if($gametype==24)
					{
						$kjhm.='<img src="image/pk'.$rs->f['n1'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n2'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n3'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n4'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n5'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n6'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n7'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n8'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n9'].'.png" style="height:20px" align=absmiddle>';
						$kjhm.='<img src="image/pk'.$rs->f['n10'].'.png" style="height:20px" align=absmiddle>';
					}
					elseif($gametype==10)
					{
						$kjhm.='<span class="betmyballNum">'.$rs->f['n3'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n2'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n1'].'</span>';
					}
					elseif($gametype>=21 && $gametype<=22){
						$kjhm.='<span class="'.($rs->f['n1']>=19?'betmyballNumRed':'betmyballNum').'">'.$rs->f['n1'].'</span>';
						$kjhm.='<span class="'.($rs->f['n2']>=19?'betmyballNumRed':'betmyballNum').'">'.$rs->f['n2'].'</span>';
						$kjhm.='<span class="'.($rs->f['n3']>=19?'betmyballNumRed':'betmyballNum').'">'.$rs->f['n3'].'</span>';
						$kjhm.='<span class="'.($rs->f['n4']>=19?'betmyballNumRed':'betmyballNum').'">'.$rs->f['n4'].'</span>';
						$kjhm.='<span class="'.($rs->f['n5']>=19?'betmyballNumRed':'betmyballNum').'">'.$rs->f['n5'].'</span>';
						$kjhm.='<span class="'.($rs->f['n6']>=19?'betmyballNumRed':'betmyballNum').'">'.$rs->f['n6'].'</span>';
						$kjhm.='<span class="'.($rs->f['n7']>=19?'betmyballNumRed':'betmyballNum').'">'.$rs->f['n7'].'</span>';
						$kjhm.='<span class="'.($rs->f['n8']>=19?'betmyballNumRed':'betmyballNum').'">'.$rs->f['n8'].'</span>';
					}
					elseif($gametype==20){
						$kjhm.='<span class="betmyballNum">'.$rs->f['n1'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n2'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n3'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n4'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n5'].'</span>';
					}
					else{
						$kjhm.='<span class="betmyballNum">'.$rs->f['n5'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n4'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n3'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n2'].'</span>';
						$kjhm.='<span class="betmyballNum">'.$rs->f['n1'].'</span>';
					}
					$kjhm.='</div>';
				}
			}
			$this->set("kjhm" , $kjhm);*/
			$this->set("game_title" , $g_gametype_3d[$gametype]['ch']);
            $this->set("news" , $news);
			$this->set("ad_panel" , $flag==1 ?'':'style="display:none"');
			$this->set("game_panel" ,$flag==0 && $gametype!=1 && $gametype!=2?'':'style="display:none"');
            $color = $conf->Get("newsClc");
            $color = $color?$color:"red";
            $this->set("color" , $color);
            //$this->load("news_3d" , "news_3d.htm");
            //$this->show("news_3d");
        }
    }

    public function showMsg3D($msg = "STOP USE")
    {
        $conf = new Config();
        $this->set("msg" , $msg);
        $this->load("systemcheck3d" , "systemcheck3d.htm");
        $this->show("systemcheck3d");
    }

    public function showErrorPage($err , $newsFlag = false)
    {
        global $g_conf;
        global $curruser;
        $acl = $curruser['acl'];
        ob_end_clean();
        ob_start();
        $this->header();
        $this->set("msg" , $err);
        $this->load("main" , "msg_3d.htm");
        $this->show("main");
        $this->footer();
        $str = ob_get_contents();
        ob_end_clean();
        echo $str;
        exit();
    }

    public function footer()
    {
        global $G_DB_QUERY_COUNT;
        global $curruser;
        global $g_cache;
        $tempStr = "";
        $msg = "";
        if ( defined("L_COPYRIGHT") )
        {
            $this->set("copyright" , L_COPYRIGHT);
        }
        else
        {
            $this->set("copyright" , G_COPYRIGHT);
        }
        if ( G_DEBUG || $curruser['acl'] == 255 )
        {
            $msg = "<br>Page Time: <b>".substr(getmicrotime() - G_SCRIPTSTART , 0 , 6)."</b>s";
            $msg .= "<br>DB Query Count: <b>".$G_DB_QUERY_COUNT."</b>";
            //if ( $curruser['account'] == G_SUPERACCOUNT )
            //{
            //    $msg .= "<br>WebServerIP:".$_SERVER['SERVER_ADDR']."</b>";
            //}
            $this->set("debugmsg" , $msg);
        }
        if ( isset($g_cache['db_sqldebug']) )
        {
            $tempStr = "<table border=1 cellpadding=2 cellspacing=0>";
            $total = 0;
            $i = 1;
            foreach ( $g_cache['db_sqldebug'] as $val )
            {
                $tempStr .= "<tr><td align=right>".$i ++."<td>".$val[0];
                $tempStr .= "<td align=right>".substr($val[2] - $val[1] , 0 , 8);
                $total += $val[2] - $val[1];
            }
            $tempStr .= "<tr><td colspan=4 align=right>".substr($total , 0 , 8)."</table>";
        }
        $this->set("dbsqldebug" , $tempStr);
        $this->load("footer" , "footer_3d.htm");
        $this->show("footer");
    }

}

?>